package com.zyy.other.locator;

/**
 * @Description: 类描述
 * @Author: zyy
 * @Date: 2023/08/12 10:30
 */
public class InitialContext {
    //根据服务名创建对应的服务
    public Service createService(String serviceName) {
        if (serviceName.equalsIgnoreCase("service-1")) {
            Service1 service1 = new Service1();
            System.out.println("new " + service1.getName());
            return service1;
        }
        if (serviceName.equalsIgnoreCase("service-2")) {
            Service2 service2 = new Service2();
            System.out.println("new " + service2.getName());
            return service2;
        }
        return null;
    }
}
